//
//  ViewController.m
//  06-模仿ImageView
//
//  Created by J on 15/11/15.
//  Copyright © 2015年 JZJ. All rights reserved.
//

#import "ViewController.h"
#import "ImageView.h"

@interface ViewController ()
{
    
    ImageView * _IMG;
    
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    ImageView * IMG =[[ImageView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];

    
    [self.view addSubview:IMG];
    
    IMG.image = [UIImage imageNamed:@"3.png"];
    
    _IMG=IMG;//全局变量保存起来
    

}
//触摸开始
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{//点击的时候重新设置属性
    
    
    _IMG.image = [UIImage imageNamed:@"5.png"];//调用set方法 在里面从新绘制
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
